import Vue from 'vue'
import App from './App.vue'
import router from './router'
import {store} from './store/store'
import dateUtils from './utils/DateUtils'

// 引入公共文件
import dev from './assets/js/dev.js'

import './assets/iconfont/iconfont.js'
import './assets/iconfont/iconfont.css'
import './plugins/qrcodejs-master/jquery.qrcode.min'
import './assets/css/base.less'


// 安装
import ElementUI from 'element-ui'
// import 'element-ui/lib/theme-chalk/reset.css'
import 'element-ui/lib/theme-chalk/index.css'
import axios from 'axios'
// import VueAxios from 'vue-axios'
import VueI18n from 'vue-i18n'

import dataV from './assets/js/dataV/datav.map.vue.js'

import Echarts from 'echarts'

 
import VueDragResize from 'vue-drag-resize' //缩放、拖拽
Vue.component('vue-drag-resize', VueDragResize) 
 

Vue.use(dataV);
Vue.use(Echarts);
 

Vue.config.productionTip = false;

Vue.prototype.dev = dev;
Vue.use(ElementUI);
// Vue.use(VueAxios,axios);
Vue.use(VueI18n);
//后端的地址
Vue.prototype.$http = axios.create({
  // baseURL: 'http://122.112.219.208:8089/wms/'
  baseURL: 'http://localhost:8080/wms/',
  // baseURL:'101.34.10.18:8080/wms/',
  headers: {
    "Accept": "*/*",
    "access-token": localStorage.getItem('token')
  },
   contentType: "application/json;charset=UTF-8",
  //contentType: "application/json",
  dataType: "json",
});

// 注册eventBus
Vue.prototype.$EventBus = new Vue()

Vue.filter('timestamp2str', function (timestamp) {
  if (!timestamp) return '';
  return dateUtils.format(new Date(timestamp));
});

Vue.filter('billType2str', function (type) {
  if (!type) return '';
  let date = '';
  if (type == 999){
    date = '质检';
  } else if (type == 998){
    date = '手动创建单据';
  } else if (type == 997){
    date = '审核';
  }  else if (type == 1){
    date = '外购入库';
  } else if (type == 2){
    date = '产品入库';
  } else if (type == 5){
    date = '委外加工入库';
  } else if (type == 10){
    date = '其他入库';
  }else if (type == 41){
    date = '调拨单';
  }else if (type == 21){
    date = '销售出库';
  } else if (type == 24){
    date = '生产领料出库';
  }else if (type == 28){
    date = '委外加工出库';
  }else if (type == 29){
    date = '其他出库';
  } else {
    date = '未知类型';
  }
  return date;
});

const i18n = new VueI18n({
  locale: 'en-US',
  messages: {
    'zh-CN': require('./common/lang/zh'),
    'en-US': require('./common/lang/en')
  }
});

new Vue({
  i18n,
  store,
  router,
  render: h => h(App)
}).$mount('#app');
